<template>
    <div>
      <div class="head">
        <div class="head-left">
          <img @click="bac()" :src="'./static/lyl/back.png'" alt="">
          <span>资讯详情</span>
        </div>
        <img :src="'./static/lyl/san.png'" alt="">
      </div>
      <div class="content">
        <h2>{{post_title}}</h2>
        <p class="p">
          <span>{{user_login}}</span>
          <span>{{post_date}}</span>
        </p>
        <!--取消 后台添加-->
        <!--<div class="con-center">-->
          <!--<img :src="smeta" alt="">-->
          <!--<p>{{post_excerpt}}</p>-->
        <!--</div>-->
        <div class="pf" v-html="html"></div>
      </div>
    </div>
</template>

<script>
  import * as home from "../../../api/home.js";
    export default {
      // name: "Detail",
      data(){
        return {
          post_title:'',
          user_login:'',
          // smeta:'',
          post_date:'',
          html:null,
          //post_excerpt:''
        }
      },
      beforeMount(){
        this.postsDetail()
      },
      mounted(){
        mui.back = function() {
          window.history.go(-1);
        }
      },
      methods:{
        bac(){
          this.$router.go(-1);
        },
        postsDetail(){
            let parms = {id:this.$route.params.id};
            home.postsDetail(parms).then(res=>{
              this.post_title = res.data.post_title;
              this.user_login = res.data.user_login;
              //this.smeta = res.data.smeta;
              this.post_date = res.data.post_date;
              this.html = res.data.post_content;
              //this.post_excerpt = res.data.post_excerpt;
            })
        }
      }
    }
</script>

<style scoped>
  .head{
    border-bottom: 1px solid #dcdcdc;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
  }
  .head .head-left img{
    width: 22px;
    vertical-align: bottom;
    margin-right: 30px;
  }
  .head .head-left span{
    font-size: 36px;
  }
  .head>img{
    width: 56px;
    align-self: center;
  }
  .content{
    padding: 20px 40px;
  }
  .content h2{
    font-size: 32px;
    line-height: 44px;
    font-weight: bold;
  }
  .content .p span:nth-child(1){
    font-size: 24px;
    color: #5587f7;
    margin-right: 20px;
  }
  .content .p span:nth-child(2){
    font-size: 22px;
    color: #8c8c8c;
  }
  .content .con-center{
    text-align: center;
    padding: 67px 0 38px 0;
  }
  .content .con-center img{
    width: 170px;
  }
  .content .con-center p:nth-child(2){
    font-size: 32px;
    line-height: 44px;
    margin: 30px 0;
  }
  .content .con-center p:nth-child(3){
    font-size: 28px;
    line-height: 44px;
    color: #884ca4;
  }
  .content .pf{
    text-indent: 32px;
    font-size: 24px;
    line-height: 44px;
    margin-bottom: 50px;
  }
  .content .pf p>img{
    width: 200px;
    height: 200px;
  }
</style>
